package handle.query;

import common.Constants.ServiceConstant;
import common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import service.AuthorityService;
import service.QueryService;
import service.VerifyService;

/**
 * Created by lxl on 2015/11/5.
 */
@Controller
@RequestMapping("ssms/query")
public class QueryUserListHandle {

    @Autowired
    private QueryService queryService ;

    @Autowired
    private VerifyService verifyService;


    @RequestMapping(value = "/user/list" ,method = RequestMethod.POST)
    public @ResponseBody Result process( @RequestBody int level , @RequestHeader String token ){

        Result result =  verifyService.verify(token, ServiceConstant.ADMIN_LEVEL) ;
        if( result.isSucces() ){

            result = queryService.queryUserList(0,0,level) ;

        }

        return  result ;
    }

}
